Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nice_things/lang/is_name.sh

is_name

Since 0.3.0 · Source

import "{ is_name }" from nice_things/lang/is_name.sh

Synopsis
is_name <string>…

Configuration

Description
Check if <string> is a valid name that can be used to name a shell variable or function. Return 0 if all arguments are names, 1 if any argument is not a valid name.

Options

Operands
<string>: Name to check.

Stdin

Stdout

Stderr

Exit status

  • 0: All arguments are names.
  • 1: One or more arguments are not valid names.

Abort

Usage examples

is_name "$1" || abort "Invalid parameter: <out_var> must be a valid name"